<?php if ( ! defined('WDK_PATH')) exit('No direct script access allowed');?>
<!--{**************************************************************************}-->
<style>
.post_title		{border-bottom:3px double #D9D9D9;padding:10px 5px;background-color: #F3F3F3;}
.post_header		{padding:12px 5px 5px;}
.post_content	{padding:25px 15px 10px;border:2px solid #EEE;background-color: #F7F7F7;line-height: 200%;margin-top:10px;}
.post_files		{margin-top:10px;}
.post_buttons	{height:20px;margin-top:15px;}
.post_url		{padding:5px 5px;font-size: 11px; color:#AAA;}
.post_ref_url	{padding:12px 5px;border-top:1px solid #D9D9D9;}
.recommend		{margin-right:10px;font-size: 11px;}
.recommend span.agree		{color:#DC4616;}
.recommend span.opposite	{color:#3A99DC;}

</style>
<!--{**************************************************************************}-->
<form id="viewForm" action="" method="POST">
<input type="hidden" name="page" value="{params.page}"/>
<input type="hidden" name="category_seq" value="{params.category_seq}"/>
<input type="hidden" name="sf" value="{params.sf}"/>
<input type="hidden" name="sk" value="{params.sk}"/>
<input type="hidden" name="bbs_id" value="{bbs.bbs_id}"/>
<input type="hidden" name="post_seq" value="{data.post_seq}"/>
<div class="post_title">
	<b>{data.post_seq}.</b> {data.post_title}
	<!--{? session.is_login }-->
	<div class="fr"><a id="btn_report" class="btn">신고</a></div>
	<!--{/}-->
</div>
<div class="post_header">
	작성자 : <a class="userinfo" uli="{data.user_login_id}">{data.user_nick_str} ({data.user_login_id})</a>
	<div class="fr">조회수 : {data.post_hits}</div>
	<!--{? bbs.bbs_recommend_flag == 'T' }-->
	<div class="fr recommend">
		<span class="agree">추천</span> : {data.post_agree}
		<span class="opposite">반대</span> : {data.post_opposite}
	</div>
	<!--{/}-->
</div>
<div class="post_url">
	Url - <a id="copyurl" class="copyurl">http://{config.domain}/post/view/{bbs.bbs_id}/{data.post_seq}</a>
	<!--{? bbs.bbs_tag_flag == 'T' }-->
	<div class="fr">
		키워드 : 
		<!--{@ data.post_tags}-->
		<!--{?.index_>0}-->, <!--{/}-->
		{.value_}
		<!--{/}-->
</div>
<!--{/}-->
</div>
<!--{? data.post_ref_url }-->
<div class="post_ref_url">참조 : <a href="{data.post_ref_url}" target="_blank">{data.post_ref_url}</a></div>
<!--{/}-->
<div class="post_content">
	{data.post_content}
	<br/>
	<div class="tr">{=date('Y-m-d H:i:s', data.post_insert_time)} [{data.post_insert_ip_str}]</div>
</div>
<!--{? data.post_files }-->
<div class="post_files">
	<!--{@ data.post_files }-->
	<a href="javascript:fDown('{.path}','{.name}')"/>{.name}</a> ({.size})
	<!--{/}-->
</div>
<!--{/}-->
<div class="post_buttons">
	<div class="fl">
		<a id="btn_list" class="btn" href="javascript:;">목록</a>
	</div>
	<div class="fr">
	<!--{? data->isScrapable() }-->
		<a id="btn_scrap" class="btn" href="javascript:;">스크랩</a>
	<!--{/}-->
	<!--{? data->isReactable() }-->
		<a id="btn_agree" class="btn" href="javascript:;">추천</a>
		<a id="btn_opposite" class="btn" href="javascript:;">반대</a>
	<!--{/}-->
	<!--{? data->isMoveUpable() }-->
		<a id="btn_move" class="btn" href="javascript:;">끌어올리기</a>
	<!--{/}-->
	<!--{? data->isEditable() }-->
		<a id="btn_del" class="btn" href="javascript:;">삭제</a>
		<a id="btn_edit" class="btn" href="javascript:;">수정</a>
	<!--{/}-->
	</div>
</div>
</form>
<!--{? bbs.bbs_comment_flag == 'T' }-->
{# include app/post/default/inc.comment.html #}
<!--{/}-->
{# plugin downloader #}
{# plugin clipboard #}
<!--{**************************************************************************}-->
<script>
(function($){
	var bbs_id = $('#viewForm>:hidden[name=bbs_id]').val();
	var post_seq = $('#viewForm>:hidden[name=post_seq]').val();
	$('#btn_list').click(function(){
		var url = $PATH+bbs_id+'/{page}/{category_seq}/{sf}/{sk}';
		url = url.replace('{page}', $('#viewForm>:hidden[name=page]').val());
		url = url.replace('{category_seq}', $('#viewForm>:hidden[name=category_seq]').val());
		url = url.replace('{sf}', $('#viewForm>:hidden[name=sf]').val());
		url = url.replace('{sk}', $('#viewForm>:hidden[name=sk]').val());
		location.href = url;
	});
	$('#btn_del').click(function(){
		if(confirm('삭제하시겠습니까?'))
		{
			$('#viewForm').attr('action', $PATH+'delete');
			$('#viewForm').submit();
		}
	});
	$('#btn_edit').click(function(){
		location.href = $PATH+'edit/'+bbs_id+'/'+post_seq;
	});
	$('#btn_agree').click(function(){
		if(confirm('이게시글을 추천 하시겠습니까?'))
		{
			$.post($PATH+'react', {'mode':'agree','bbs_id':bbs_id,'post_seq':post_seq}, function(json){
				if(json.error)	return alert(json.msg);
				$('#btn_agree').remove();
				$('#btn_opposite').remove();
				alert('추천 되었습니다.');
			}, 'json')
		}
	});
	$('#btn_opposite').click(function(){
		if(confirm('이게시글을 비추천 하시겠습니까?'))
		{
			$.post($PATH+'react', {'mode':'opposite','bbs_id':bbs_id,'post_seq':post_seq}, function(json){
				if(json.error)	return alert(json.msg);
				$('#btn_agree').remove();
				$('#btn_opposite').remove();
				alert('비추천 되었습니다.');				
			}, 'json')
		}
	});
	$('#btn_scrap').click(function(){
		if(confirm('이게시글을 스크랩 하시겠습니까?'))
		{
			$.post($PATH+'scrap', {'bbs_id':bbs_id,'post_seq':post_seq}, function(json){
				if(json.error)	return alert(json.msg);
				$('#btn_scrap').remove();
				alert('스크랩 되었습니다.');				
			}, 'json')
		}
	});
	$('#btn_moveup').click(function(){
		if(confirm('끌어올리기 기능을 사용하여 게시물을 상단에 위치 하시겠습니까?'))
		{
			$.post($PATH+'moveup', {'bbs_id':bbs_id,'post_seq':post_seq}, function(json){
				if(json.error)	return alert(json.msg);
				$('#btn_moveup').remove();
				alert('상단으로 글어올렸습니다.');				
			}, 'json')
		}
	});
	$('#btn_report').click(function(){
		if(confirm('이 게시글을 신고 하시겠습니까??'))
		{
			$.post($PATH+'report_post', {'bbs_id':bbs_id,'post_seq':post_seq}, function(json){
				if(json.error)	return alert(json.msg);
				alert('신고 되었습니다.');
			}, 'json')
		}
	});
	$('#copyurl').clipboard();
})(jQuery);
</script>
<!--{**************************************************************************}-->